package com.yusheng.tr.common.core.openfeign.factory;



import com.yusheng.exceptions.BizException;
import com.yusheng.exceptions.ExceptionEnum;
import com.yusheng.tr.common.core.openfeign.base.ISysMenuFeignService;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.Set;

/**
 * @ClassName jiang_jun_qin
 * @date 2023/4/13 17:49
 * @Version 1.0
 */
@Component
public class SysMenuFeignServiceFallback implements FallbackFactory<ISysMenuFeignService> {
    @Override
    public ISysMenuFeignService create(Throwable cause) {
        return new ISysMenuFeignService() {
            @Override
            public Set<String> selectMenuPermsByRoleId(Long roleId) {
                throw new BizException(ExceptionEnum.FEIGN_ERROR);
            }

            @Override
            public Collection<String> selectMenuPermsByUserId(Long userId) {
                throw new BizException(ExceptionEnum.FEIGN_ERROR);
            }
        };
    }
}
